From: Marek Vasut Date: Fri, 14 Jun 2019 13:55:04 +0000 (+0200) Subject: rcar_gen3: drivers: qos: Add function to configure DBSC QoS settings from a table X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22/%22https:/collectd.org/%22?a=commitdiff_plain;h=d875f93642b6c9641316024af6a215f0151dad62;p=project%2Fbcm63xx%2Fatf.git rcar_gen3: drivers: qos: Add function to configure DBSC QoS settings from a table The DBSC QoS settings can be programmed by iterating over a table with register-value pairs and writing those to the registers, add function to do just that. Subsequent patches will convert the DBSC QoS setting functions for each SoC to this new function. Signed-off-by: Marek Vasut Change-Id: I949c46a0f032661a58000cb5f7829349e973438c --- diff --git a/drivers/staging/renesas/rcar/qos/qos_common.h b/drivers/staging/renesas/rcar/qos/qos_common.h index 64a89f80..2c130aee 100644 --- a/drivers/staging/renesas/rcar/qos/qos_common.h +++ b/drivers/staging/renesas/rcar/qos/qos_common.h @@ -128,7 +128,15 @@ typedef struct { uint64_t value; } mstat_slot_t; +struct rcar_gen3_dbsc_qos_settings { + uint32_t reg; + uint32_t val; +}; + extern uint32_t qos_init_ddr_ch; extern uint8_t qos_init_ddr_phyvalid; +void rcar_qos_dbsc_setting(struct rcar_gen3_dbsc_qos_settings *qos, + unsigned int qos_size, bool dbsc_wren); + #endif /* QOS_COMMON_H */ diff --git a/drivers/staging/renesas/rcar/qos/qos_init.c b/drivers/staging/renesas/rcar/qos/qos_init.c index 7a564cf7..884e031c 100644 --- a/drivers/staging/renesas/rcar/qos/qos_init.c +++ b/drivers/staging/renesas/rcar/qos/qos_init.c @@ -11,6 +11,7 @@ #include "qos_init.h" #include "qos_common.h" +#include "qos_reg.h" #if RCAR_LSI == RCAR_AUTO #include "H3/qos_init_h3_v10.h" #include "H3/qos_init_h3_v11.h" @@ -389,3 +390,20 @@ uint32_t get_refperiod(void) return refperiod; } #endif + +void rcar_qos_dbsc_setting(struct rcar_gen3_dbsc_qos_settings *qos, + unsigned int qos_size, bool dbsc_wren) +{ + int i; + + /* Register write enable */ + if (dbsc_wren) + io_write_32(DBSC_DBSYSCNT0, 0x00001234U); + + for (i = 0; i < qos_size; i++) + io_write_32(qos[i].reg, qos[i].val); + + /* Register write protect */ + if (dbsc_wren) + io_write_32(DBSC_DBSYSCNT0, 0x00000000U); +}